package io.rainforest.rss.common.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 时间工具
 * @author r0ad
 * @version 1.0
 */
public class DateUtil {
    public static String timeStringFromMillions(Double millions,String format){
        // 将毫秒数转换为Date对象
        long milliseconds = (long) (millions * 1);
        Date date = new Date(milliseconds);
        // 使用SimpleDateFormat将Date对象格式化为指定格式的时间字符串
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }

    public static void main(String[] args) {

        System.out.println(timeStringFromMillions(1266996019000.0,"yyyy-MM-dd HH:mm:ss"));
    }
}
